home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / demos.idb / usr / demos / General_Demos / CyberAnatomy101 / RUN.z / RUN
Encoding:
Text File  |  1997-06-26  |  5.7 KB  |  163 lines

  1. #!/bin/sh
  2. #Tag 0x9085
  3.  
  4. #**************************************************************************
  5. #*                                                      *
  6. #*          Copyright (c) 1996 Silicon Graphics, Inc.               *
  7. #*                  All Rights Reserved                         *
  8. #*                                                      *
  9. #*       THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI           *
  10. #*                                                      *
  11. #* The copyright notice above does not evidence any actual of intended    *
  12. #* publication of such source code, and is an unpublished work by Silicon *
  13. #* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is *
  14. #* the property of Silicon Graphics, Inc. Any use, duplication or       *
  15. #* disclosure not specifically authorized by Silicon Graphics is strictly *
  16. #* prohibited.                                              *
  17. #*                                                      *
  18. #* RESTRICTED RIGHTS LEGEND:                                    *
  19. #*                                                      *
  20. #* Use, duplication or disclosure by the Government is subject to       *
  21. #* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in   *
  22. #* Technical Data and Computer Software clause at DFARS 52.227-7013,      *
  23. #* and/or in similar or successor clauses in the FAR, DOD or NASA FAR     *
  24. #* Supplement. Unpublished - rights reserved under the Copyright Laws of  *
  25. #* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N.       *
  26. #* Shoreline Blvd., Mountain View, CA 94039-7311                    *
  27. #**************************************************************************
  28.  
  29. # Where do we want to go
  30. URL="file:/usr/demos/General_Demos/CyberAnatomy101/data/intro.html"
  31.  
  32.  
  33. #
  34. # Default place to start up Netscape at,
  35. # currently assuming a 1280x1024 display
  36. #
  37. #GEOMETRY should be of the form "1250x970+15+0"
  38. GEOMETRY="1250x970+15+0"
  39.  
  40. DISPLAY="localhost:0.0"; export DISPLAY
  41. NETSCAPE_3PREF="/usr/demos/Demo_Interfaces/Web/common/preferences"
  42. NETSCAPE_4PREF="/usr/demos/Demo_Interfaces/Web/common/preferences.js"
  43. NETSCAPE_4XDEFAULTS="/usr/demos/Demo_Interfaces/Web/common/Xdefaults"
  44.  
  45. remove_lock() {
  46.    if [ -l $HOME/.netscape/lock ]
  47.    then
  48.       rm $HOME/.netscape/lock
  49.    fi
  50. }
  51.  
  52. launch_ns4() {
  53.    remove_lock
  54.    #
  55.    # netscape4 currently (beta) does not take -geometry or -xrm don't use it.
  56.    #
  57.    # netscape4 will respect an xrdb info with absolute
  58.    # positioning, so get the old value, use desired value and return
  59.    # xrdb to either default or previous setting.
  60.    #
  61.    XRDBNSG=`xrdb -q | fgrep -i netscape | fgrep -i geometry`
  62.    echo "Netscape.Navigator.geometry: =$GEOMETRY" | xrdb -override 
  63.    /usr/bin/X11/netscape $URL &
  64.    sleep 20  # Time so netscape can start up
  65.    if [ -z "$XRDBNSG" ]
  66.    then
  67.       if [ "$USER" = "demos" ]
  68.       then
  69.          # demos default Netscape geometry is 720x887
  70.          echo "Netscape.Navigator.geometry: =835x942" | xrdb -override
  71.       else 
  72.          # Netsape's default geometry is 720x887
  73.          echo "Netscape.Navigator.geometry: =720x887" | xrdb -override
  74.       fi
  75.    else
  76.       echo $XRDBNSG |xrdb -override
  77.    fi
  78.       
  79. }
  80.  
  81. launch_ns3() {
  82.    remove_lock
  83.    #
  84.    # since .Xdefaults overrides Netscape's -geometry option
  85.    # we have to use -xrm which overrides .Xdefaults, the demos account provides
  86.    # an Xdefaults file so that Netscape is a little larger than normal.
  87.    # Some users may have specified Netscape geometry in their Xdefaults file.
  88.    # So do the right thing and specify what we want
  89.    #
  90.    /usr/bin/X11/netscape -xrm "Netscape.Navigator.geometry: $GEOMETRY" $URL &
  91. }
  92.  
  93. # Assuming Navigator is 3.X and Communicator is 4.X
  94. NSVERSION=`showprods -D1 netscape netscape_gold |egrep "Navigator|Communicator"`
  95.  
  96. case "$NSVERSION" in
  97.  
  98.    *Communicator*)
  99.        # If USER null, assume script is being run from the Web Interface
  100.        # under the USER name as nobody. So we need to set up a fake home
  101.        # directory, else run netscape4
  102.        if [ -z "$USER" ]
  103.        then
  104.           HOME="/tmp/nobodyNetscapeHome" ; export HOME
  105.           if [ ! -d $HOME ]
  106.           then
  107.              mkdir -p $HOME/.netscape/cache $HOME/.netscape/archive
  108.              # the preferences file has browser width and height which
  109.              # netscape 4 will respect, but no way for absolute positioning
  110.              # in the preferences
  111.              if [ -f $NETSCAPE_4PREF ]
  112.              then
  113.                 cp $NETSCAPE_4PREF $HOME/.netscape
  114.              fi
  115.          launch_ns4
  116.  
  117.           # If $HOME is set up check to see if it has the old preferences file and replace it
  118.           else
  119.              if [ -f $HOME/.netscape/preferences ]
  120.          then
  121.                 rm $HOME/.netscape/preferences
  122.              fi
  123.              if [ ! -f $HOME/.netscape/preferences.js ]
  124.          then
  125.                 if [ -f $NETSCAPE_4PREF ]
  126.                 then
  127.                    cp $NETSCAPE_4PREF $HOME/.netscape
  128.                 fi
  129.              fi
  130.          launch_ns4
  131.           fi
  132.        else
  133.       launch_ns4
  134.        fi
  135.        ;;
  136.  
  137.    # If not Communicator then at least try Netscape with Navigator's environment
  138.    *Navigator*|*)
  139.        # If USER null, assume script is being run from the Web Interface
  140.        # under the USER name as nobody. So we need to set up a fake home
  141.        # directory. 
  142.        if [ -z "$USER" ]
  143.        then
  144.           HOME="/tmp/nobodyNetscapeHome" ; export HOME
  145.           if [ ! -d $HOME ]
  146.           then
  147.              mkdir -p $HOME/.netscape/cache
  148.              if [ -f $NETSCAPE_3PREF ]
  149.              then
  150.                 cp $NETSCAPE_3PREF $HOME/.netscape
  151.              fi
  152.           fi
  153.           launch_ns3
  154.  
  155.        # If USER is set then assume this script was run from the desktop
  156.        # Either demos or another user
  157.        else
  158.           launch_ns3
  159.        fi
  160.        ;;
  161.  
  162. esac
  163.